import time

from selenium.webdriver.common.by import By
from pom.base_page import BasePage


class SysSettingPage(BasePage):
    def data_middle_platform(self):
        self.driver.find_element(By.XPATH, '//div[2]/div/div[1]/div[2]/div[1]/div/ul/div[8]/li/ul/div[1]/a/li').click()

        time.sleep(2)
        platform_name = self.driver.find_element(By.XPATH, '//div[2]/div/div[2]//div/div[2]/div[3]//tr[1]/td[3]/div').text
        address = self.driver.find_element(By.XPATH, '//div[2]/div/div[2]//div/div[2]/div[3]//tr[1]/td[5]/div').text
        director = self.driver.find_element(By.XPATH, '//div[2]/div/div[2]//div/div[2]/div[3]//tr[1]/td[7]/div').text
        print(platform_name, address, director, "******************************")

        assert platform_name == "区块链"
        assert address == "10.14.216.10"
        assert director == "曹经理"

    def os_parameter(self):
        self.driver.find_element(By.XPATH, '//div[2]/div/div[1]/div[2]/div[1]/div/ul/div[8]/li/ul/div[2]/a/li').click()

        time.sleep(2)
        param_name = self.driver.find_element(By.XPATH, '//div[2]/div/div[2]//div/div[2]/div[3]//tr[1]/td[3]/div').text
        param_code = self.driver.find_element(By.XPATH, '//div[2]/div/div[2]//div/div[2]/div[3]//tr[1]/td[4]/div').text
        remarks = self.driver.find_element(By.XPATH, '//div[2]/div/div[2]//div/div[2]/div[3]//tr[1]/td[6]/div').text
        print(param_name, param_code, remarks, "*****************************")

        assert param_name == "GET"
        assert param_code == "GET"
        assert remarks == "GET"

    def parameter_type(self):
        self.driver.find_element(By.XPATH, '//div[2]/div/div[1]/div[2]/div[1]/div/ul/div[8]/li/ul/div[3]/a/li').click()

        time.sleep(2)
        chinese_name = self.driver.find_element(By.XPATH, '//div[2]/div/div[2]//div/div[2]/div[3]//tr[1]/td[3]/div').text
        code_name = self.driver.find_element(By.XPATH, '//div[2]/div/div[2]//div/div[2]/div[3]//tr[1]/td[4]/div').text
        remarks = self.driver.find_element(By.XPATH, '//div[2]/div/div[2]//div/div[2]/div[3]//tr[1]/td[5]/div').text
        print(chinese_name, code_name, remarks, "**************************")

        assert chinese_name == "Request"
        assert code_name == "请求方式"
        assert remarks == "--"
